home *** CD-ROM | disk | FTP | other *** search
/ Business & Presentations / Business and Presentations - Volume 1 (1995)(Sideface)(NL).iso / drivers / hpps76 / hpps.asm next >
Assembly Source File  |  1989-06-20  |  14KB  |  628 lines

  1.         page    78,122
  2.         title    HPPS -- HP LaserJet+/SeriesII PrtSc Driver 7.6
  3. ;Revision history:
  4. ;06/02/89 Modified to read from all planes in EGA mode : 7.6
  5. ;05/14/89 Modified Text Screen printing for BBS's status lines : 7.5
  6. ;01/30/89 Translation table purged if /2 option (SeriesII) used : 7.4
  7. ;01/11/89 Added Margin Reset and released source code : 7.3
  8. ;01/04/89 Added Printer Reset to init strings : 7.2
  9. ;----------------------------------------------------------------------------
  10.  
  11. data        segment at 40h
  12.  
  13.         org    84h
  14. rows        db    ?
  15.  
  16. data        ends
  17.  
  18. ;----------------------------------------------------------------------------
  19.  
  20. EGA_seg        segment at 0a000h
  21. EGA_seg        ends
  22.  
  23. ;----------------------------------------------------------------------------
  24.  
  25. MON_seg        segment at 0b000h
  26. MON_seg        ends
  27.  
  28. ;----------------------------------------------------------------------------
  29.  
  30. CGA_seg        segment at 0b800h
  31. CGA_seg        ends
  32.  
  33. ;----------------------------------------------------------------------------
  34.  
  35. code        segment para 'code' 
  36.         assume    cs:code,ds:code,es:code
  37.  
  38. cseg_start    equ    $
  39.  
  40.         org    100h
  41.  
  42. start:        jmp    PrtSc
  43.  
  44. ;---------------------------------------
  45.  
  46. hp_EGAinit    db    27,'E',27,'9',27,'&l0O',27,'&a1000h720V',27,'*t75R',27,'*r1A',0 
  47. hp_EGAline     db    27,'*b44W',0
  48. hp_EGAlineE     db    27,'*b50W',0
  49. hp_CGAinit    db    27,'E',27,'9',27,'&l0O',27,'&a600h600V',27,'*t100R',27,'*r1A',0 
  50. hp_CGAline     db    27,'*b80W',0
  51. hp_Text        db    27,'E',27,'9',27,'(8U',27,'(s0p10H',0
  52. hp_Text2    db    27,'E',27,'9',27,'(10U',27,'(s0p10H',0
  53. hp_CGAtext40    db    27,'&a0C',27,'&p40X',0
  54. hp_CGAtext80    db    27,'&a0C',27,'&p80X',0
  55. hp_end        db    27,'*rB',27,'&a0C',12,0 
  56. hp_crlf        db    13,10,0 
  57. hp_ff        db    12,0 
  58.  
  59. busy        db    0 
  60. reverse        db    0
  61. seriesII    db    0
  62.  
  63. mode        db    ? 
  64. width_        db    ? 
  65. vpage        db    ?
  66.  
  67. vid_seg        dw    ?
  68. delta        dw    ?
  69.  
  70. line_buffer    db    352 dup (0) 
  71.  
  72. ;---------------------------------------
  73. ;        Screen snapshot routine 
  74.  
  75. snapshot:    cmp    cs:[busy],0    ;Continue if not busy 
  76.         jz    go_ahead    ;
  77.         iret            ; 
  78.  
  79. go_ahead:    inc    cs:[busy]    ;Set busy 
  80.  
  81.         sti            ;let the dogs back in
  82.  
  83.         push    ax         ;save state
  84.         push    bx 
  85.         push    cx 
  86.         push    dx 
  87.         push    bp 
  88.             push    si 
  89.         push    di 
  90.         push    ds 
  91.         push    es 
  92.  
  93.         mov    ax,cs        ;setup ds,es
  94.          mov    ds,ax        ;
  95.         mov    es,ax        ;
  96.  
  97.         cld            ;set direction flag
  98.  
  99.         mov    ah,15        ;Get video mode 
  100.         int    10H        ; 
  101.         mov    [mode],al    ; 
  102.         mov    [width_],ah    ; 
  103.         mov    [vpage],bh    ; 
  104.  
  105.         cmp    al,4        ;See if 0-3 
  106.         jb    CGA_Text    ;Text modes use same routine 
  107.  
  108.         cmp    al,7        ;see if mode 4-6
  109.         je    CGA_Text    ;mod 7 is text
  110.         ja    try_EGAmD    ;
  111.         jmp    CGA_G6        ;
  112.  
  113. try_EGAmD:    cmp    al,0dH        ;CGA/EGA 320x200
  114.         jne    try_EGAmE
  115.         jmp    EGA_modeDE
  116.  
  117. try_EGAmE:    cmp    al,0eh        ;CGA/EGA 640x200
  118.         jne    try_MONmF    ;
  119.         jmp    EGA_modeDE    ;
  120.  
  121. try_MONmF:    cmp    al,0fh        ;MON 640x350
  122.         jne    try_EGAm10    ;
  123.         jmp    MON_modeF    ;
  124.  
  125. try_EGAm10:    cmp    al,10H        ;EGA Hi-res modes 
  126.         jne    cant_do
  127.          jmp    EGA_mode10
  128.  
  129. cant_do:    call    beep        ;beep now and again
  130.         jmp    exit        ;none of the above 
  131.  
  132. ;---------------------------------------
  133.  
  134. CGA_Text:    mov    ah,3        ;get cursor position
  135.         int    10h        ;
  136.         push    dx        ;save it for later restore
  137.  
  138.         mov    bx,offset hp_Text    ;Init Printer
  139.         cmp    [seriesII],0        ;for LaserJet+
  140.         je    init_text        ;
  141.         mov    bx,offset hp_Text2    ;for SeriesII
  142. init_text:    call    print_msg        ;
  143.  
  144.         xor    dx,dx        ;set to start at top of screen
  145.  
  146.         mov    ax,1200h    ;see if EGA here
  147.         mov    bx,0ff10h    ;set bh to illegal value
  148.         int    10h        ;
  149.  
  150.         mov    cl,[width_]
  151.         mov    ch,25        ;25 lines default for CGA adapter
  152.  
  153.         cmp    bh,0ffh        ;see if bh changed
  154.         je    T1        ;no -- don't update ch
  155.  
  156.         assume    ds:data
  157.         push    ds        ;save ds
  158.         mov    ax,data        ;set for BIOS data area
  159.         mov    ds,ax        ;
  160.         mov    ch,[rows]    ;
  161.         inc    ch        ;
  162.         pop    ds        ;
  163.         assume    ds:code
  164.  
  165. T1:        mov    bx,offset hp_CGAtext40
  166.         cmp    cl,40
  167.         je    T2
  168.         mov    bx,offset hp_CGAtext80
  169.  
  170. T2:        push    bx
  171.         push    dx
  172.         call    print_msg
  173.         pop    dx
  174.  
  175. T3:        push    dx        ;save cursor position 
  176.  
  177.         mov    bh,[vpage]    ;set new cursor position
  178.         mov    ah,2        ;
  179.         int    10h        ;
  180.  
  181.         mov    ah,8        ;read char at cursor position
  182.         int    10h        ;
  183.  
  184.         cmp    [seriesII],0    ;see if seriesII
  185.         jnz    series2        ;yes - skip xlate
  186.         mov    bx,offset xlat_
  187.         xlat            ;translate char
  188.  
  189. series2:    xor    dx,dx        ;set for lpt1:
  190.         xor    ah,ah        ;ah=0 print char
  191.         int    17h        ;print it
  192.         
  193.         pop    dx        ;restore cursor position
  194.  
  195.         inc    dl        ;bump column counter
  196.         cmp    dl,cl        ;EOL ?
  197.         jnz    T3        ;no -- same line, do next char
  198.  
  199.         xor    dl,dl        ;reset column counter
  200.  
  201.         push    dx
  202.         mov    bx,offset hp_crlf    ;print crlf 
  203.         call    print_msg        ; 
  204.         pop    dx
  205.  
  206.         pop    bx
  207.  
  208.         inc    dh        ;bump row counter
  209.         cmp    dh,ch        ;end of screen ?
  210.         jnz    T2        ;no -- do next line
  211.  
  212.         pop    dx        ;restore cursor position
  213.         mov    ah,2        ;
  214.         mov    bh,[vpage]    ;
  215.         int    10h        ;
  216.  
  217.         mov    bx,offset hp_ff    ;eject page
  218.         call    print_msg
  219.  
  220.         jmp    exit        ;bye
  221.         
  222. ;---------------------------------------
  223.  
  224. CGA_G6:        mov    ax,CGA_Seg
  225.         mov    ds,ax
  226.  
  227.         mov    bx,offset hp_CGAinit
  228.         call    print_msg
  229.  
  230.         mov    si,0H
  231.  
  232.         mov    cx,100
  233. CGA_G6loop1:    push    cx
  234.         push    si
  235.  
  236.         mov    cx,2        ;print two lines per iteration
  237. CGA_G6loop1a:    push    cx
  238.         push    si
  239.  
  240.         mov    cx,2        ;print each line twice for aspect ratio
  241. CGA_G6loop2:    push    cx
  242.         push    si        ;save SI for second time printing
  243.  
  244.         mov    bx,offset hp_CGAline
  245.         call    print_msg
  246.  
  247.         mov    cx,80
  248. CGA_G6loop3:    lodsb                
  249.         xor    al,cs:[reverse]
  250.         xor    ah,ah
  251.         int    17H
  252.         loop    CGA_g6loop3
  253.  
  254.         pop    si
  255.  
  256.         pop    cx
  257.         loop    CGA_G6loop2
  258.  
  259.         pop    si
  260.         add    si,8*1024    ;odd scan lines are 8K further in buffer
  261.  
  262.         pop    cx
  263.         loop    CGA_G6loop1a
  264.  
  265.         pop    si
  266.         add    si,80        ;next even line is 80 bytes in buffer
  267.  
  268.         pop    cx
  269.         loop    CGA_G6loop1
  270.  
  271.         mov    bx,offset hp_end
  272.         call    print_msg
  273.  
  274.         jmp    exit
  275.  
  276. ;---------------------------------------
  277.  
  278. EGA_modeDE:    mov    bx,40
  279.         mov    cx,8192/16
  280.  
  281.         cmp    al,0dh        ;320x200 ?
  282.         je    no_shift    ;yes dont adjust
  283.  
  284.         shl    bx,1        ;bx=80
  285.         shl    cx,1        ;cx=16384/16
  286.  
  287. no_shift:    mov    al,[vpage]    ;index into correct page
  288.         xor    ah,ah        ;
  289.         mul    cx        ;
  290.         add    ax,EGA_seg    ;
  291.         mov    [vid_seg],ax    ;
  292.  
  293.         mov    cx,bx        ;
  294.         mov    [delta],bx    ;
  295.         
  296.         mov    bx,offset hp_EGAinit
  297.         call    print_msg
  298.  
  299. EGAmEloop1:    push    cx        ;
  300.  
  301.         mov    si,cx
  302.         dec    si
  303.  
  304.         mov    ax,[vid_seg]    ;EGA RAM Buffer
  305.         push    ds
  306.         mov    ds,ax
  307.         mov    di,offset line_buffer    ;
  308.         mov    cx,200        ;read in one column for 200 rows
  309. EGAmEloop2:      call    get_byteEGA     ;(DS:SI) --> (ES:DI)
  310.                 inc     di
  311.         add    si,es:[delta]    ; move pointers
  312.         loop    EGAmEloop2
  313.         pop    ds
  314.  
  315.         mov    cx,8
  316. EGAmEloop3:    push    cx
  317.  
  318.         mov    cx,1
  319.         cmp    [mode],0dh    ; 320x200 mode ?
  320.         jne    dont_repeat    ;no
  321.         inc    cx        ;print line twice
  322.  
  323. dont_repeat:    push    cx
  324.  
  325.         mov    bx,offset hp_EGAlineE
  326.                call    print_msg
  327.  
  328.         mov    si,offset line_buffer
  329.         mov    cx,50        ;50 bytes will be output
  330. EGAmEloop4:    push    cx        ;
  331.  
  332.         xor    al,al        ;clear acc
  333.         mov    cx,4        ;
  334. EGAmEloop5:    shl    al,1        ;bump acc
  335.         mov    ah,[si]        ;get byte
  336.         and    ah,1        ;get lsb
  337.         or    al,ah        ;move into acc
  338.         shl    al,1        ;bump acc
  339.         or    al,ah        ;merge
  340.         inc    si
  341.         loop    EGAmEloop5    ;
  342.  
  343.         xor    al,[reverse]
  344.         xor    ah,ah        ; Output Byte
  345.         int    17h        ;
  346.  
  347.         pop    cx        ;
  348.         loop    EGAmEloop4    ;
  349.  
  350.         pop    cx        ;do second line?
  351.         loop    dont_repeat    ;if cx=2 then yes
  352.  
  353.         mov    si,offset line_buffer
  354.         mov    cx,200        ;
  355. EGAmEloop6:    shr    byte ptr [si],1    ;shift byte for next time
  356.         inc    si
  357.         loop    EGAmEloop6
  358.  
  359.         pop    cx
  360.         loop    EGAmEloop3
  361.  
  362.         pop    cx        ;do next column
  363.         loop    EGAmEloop1    ;
  364.  
  365.         mov    bx,offset hp_end
  366.         call    print_msg
  367.  
  368.         jmp    exit
  369.  
  370. ;---------------------------------------
  371.  
  372. MON_modeF:    mov    ax,MON_seg
  373.         jmp    short EGA_hires
  374.  
  375. EGA_mode10:    mov    ax,EGA_seg
  376.  
  377. EGA_hires:    mov    [vid_seg],ax
  378.  
  379.         mov    bx,offset hp_EGAinit
  380.         call    print_msg
  381.  
  382.         mov    cx,80        ;loop through 80 cols
  383. EGAm10loop1:    push    cx        ;
  384.  
  385.         mov    si,cx
  386.         dec    si
  387.  
  388.         mov    ax,[vid_seg]    ;MON/EGA RAM Buffer
  389.         push    ds
  390.         mov    ds,ax
  391.         mov    di,offset line_buffer    ;
  392.         mov    cx,350        ;read in one column for 350 rows
  393.  
  394. EGAm10loop2:    call    get_byteEGA     ;(DS:SI) --> (ES:DI)
  395.                 inc     di
  396.         add    si,80           ; move pointers
  397.         loop    EGAm10loop2
  398.         pop    ds
  399.  
  400.         mov    cx,8
  401. EGAm10loop3:    push    cx
  402.  
  403.         mov    bx,offset hp_EGAline
  404.                call    print_msg
  405.  
  406.         mov    si,offset line_buffer
  407.         mov    cx,44        ;44 bytes will be output
  408. EGAm10loop4:    push    cx        ;
  409.  
  410.         xor    al,al        ;clear acc
  411.         mov    cx,8        ;build each 44 bit by